{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "fb89cab4",
   "metadata": {},
   "source": [
    "## 上周学习内容\n",
    "* python第一行代码\n",
    "* 观察标准库\n",
    "\n",
    "#### 重要资源\n",
    "> [python官网](https://python.org)\n",
    "\n",
    "## 本周学习内容\n",
    "\n",
    "#### 1.python环境配置\n",
    "* [pycharm](https://www.jetbrains.com/pycharm/)\n",
    "> a.项目管理类的IDE\n",
    "\n",
    "> b.[github education pack](https://education.github.com/pack)可获取免费一年，专业版使用\n",
    "\n",
    "\n",
    "#### 2.项目1：奇数中选择指定时间\n",
    "\n",
    "#### 3.变量\n",
    "\n",
    "#### 4.if else条件判断"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "61f351b6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This minute seems a little odd.\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "odds = [ 1, 3, 5, 7, 9, 11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "right_this_minute = datetime.today().minute\n",
    "\n",
    "if right_this_minute in odds:\n",
    "    print(\"This minute seems a little odd.\")\n",
    "else:\n",
    "    print(\"Not an odd minute.\")\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "0b4d491f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Zhichao Zhichao\n",
      "What is the value of name2 now?\n",
      "Youge Zhichao\n"
     ]
    }
   ],
   "source": [
    "name = \"Zhichao\"\n",
    "\n",
    "name2 = name\n",
    "print(name,name2)\n",
    "\n",
    "name = \"Youge\"\n",
    "\n",
    "print(\"What is the value of name2 now?\")\n",
    "print(name,name2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "0baef192",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Work,work,work.\n"
     ]
    }
   ],
   "source": [
    "import datetime\n",
    "today =datetime.date.today().day\n",
    "if today == 'Saturday':\n",
    "    print('Party!')\n",
    "elif today == 'Sunday':\n",
    "    if condition == 'Headache':\n",
    "        print('Recover,then rest.')\n",
    "    else:\n",
    "        print('Rest.')\n",
    "else:\n",
    "    print('Work,work,work.')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f7e6cd1a",
   "metadata": {},
   "source": [
    "#### for循环"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "0ff2451d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n"
     ]
    }
   ],
   "source": [
    "for i in [1,2,3]:\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "1018e1df",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "H\n",
      "i\n",
      "!\n"
     ]
    }
   ],
   "source": [
    "for ch in \"Hi!\":\n",
    "    print(ch)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "a8818e19",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n"
     ]
    }
   ],
   "source": [
    "for num in range(5):\n",
    "    print('Head First Rocks!')"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f0a75603",
   "metadata": {},
   "source": [
    "#### 用Format…Indent Region缩进代码组"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "da1b7864",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This minute seems a little odd.\n",
      "This minute seems a little odd.\n",
      "This minute seems a little odd.\n",
      "This minute seems a little odd.\n",
      "This minute seems a little odd.\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "odds = [ 1, 3, 5, 7, 9, 11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "for i in range(5):\n",
    "    right_this_minute = datetime.today().minute\n",
    "    if right_this_minute in odds:\n",
    "        print(\"This minute seems a little odd.\")\n",
    "    else:\n",
    "        print(\"Not an odd minute.\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c854f729",
   "metadata": {},
   "source": [
    "#### randint函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "7976524d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n",
      "Head First Rocks!\n"
     ]
    }
   ],
   "source": [
    "for num in range(5):\n",
    "    print('Head First Rocks!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "cd2ee903",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time\n",
    "time.sleep(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "a0429a74",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "20"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import random\n",
    "random.randint(1,60)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "786515ce",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "This minute seems a little odd.\n",
      "This minute seems a little odd.\n",
      "This minute seems a little odd.\n",
      "This minute seems a little odd.\n",
      "This minute seems a little odd.\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "\n",
    "import random\n",
    "import time\n",
    "\n",
    "odds = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59]\n",
    "\n",
    "for i in range(5):\n",
    "    right_this_minute = datetime.today().minute\n",
    "    if right_this_minute in odds:\n",
    "        print(\"This minute seems a little odd.\")\n",
    "    else:\n",
    "        print(\"Not an odd minute.\")\n",
    "    wait_time = random.randint(1,5)\n",
    "    time.sleep(wait_time)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4f59ca6a",
   "metadata": {},
   "source": [
    "#### Range试验"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "59a9cd3a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "range(0, 5)"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "range(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "c51ee374",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 1, 2, 3, 4]"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(5))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "c164faf3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[5, 6, 7, 8, 9]"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(5,10))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "48298c8b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[0, 2, 4, 6, 8]"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(0,10,2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "0f045575",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[10, 8, 6, 4, 2]"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(10,0,-2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "f3cb3ba4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(10,0,2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "aacbc19e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[99,\n",
       " 98,\n",
       " 97,\n",
       " 96,\n",
       " 95,\n",
       " 94,\n",
       " 93,\n",
       " 92,\n",
       " 91,\n",
       " 90,\n",
       " 89,\n",
       " 88,\n",
       " 87,\n",
       " 86,\n",
       " 85,\n",
       " 84,\n",
       " 83,\n",
       " 82,\n",
       " 81,\n",
       " 80,\n",
       " 79,\n",
       " 78,\n",
       " 77,\n",
       " 76,\n",
       " 75,\n",
       " 74,\n",
       " 73,\n",
       " 72,\n",
       " 71,\n",
       " 70,\n",
       " 69,\n",
       " 68,\n",
       " 67,\n",
       " 66,\n",
       " 65,\n",
       " 64,\n",
       " 63,\n",
       " 62,\n",
       " 61,\n",
       " 60,\n",
       " 59,\n",
       " 58,\n",
       " 57,\n",
       " 56,\n",
       " 55,\n",
       " 54,\n",
       " 53,\n",
       " 52,\n",
       " 51,\n",
       " 50,\n",
       " 49,\n",
       " 48,\n",
       " 47,\n",
       " 46,\n",
       " 45,\n",
       " 44,\n",
       " 43,\n",
       " 42,\n",
       " 41,\n",
       " 40,\n",
       " 39,\n",
       " 38,\n",
       " 37,\n",
       " 36,\n",
       " 35,\n",
       " 34,\n",
       " 33,\n",
       " 32,\n",
       " 31,\n",
       " 30,\n",
       " 29,\n",
       " 28,\n",
       " 27,\n",
       " 26,\n",
       " 25,\n",
       " 24,\n",
       " 23,\n",
       " 22,\n",
       " 21,\n",
       " 20,\n",
       " 19,\n",
       " 18,\n",
       " 17,\n",
       " 16,\n",
       " 15,\n",
       " 14,\n",
       " 13,\n",
       " 12,\n",
       " 11,\n",
       " 10,\n",
       " 9,\n",
       " 8,\n",
       " 7,\n",
       " 6,\n",
       " 5,\n",
       " 4,\n",
       " 3,\n",
       " 2,\n",
       " 1]"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(range(99,0,-1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2b765619",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
